package com.bstek.uflo.form.controller;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;

import com.bstek.dorado.web.resolver.AbstractResolver;

/**
 * @author Jacky.gao
 * @since 2013年11月13日
 */
public class FormDesignerController extends AbstractResolver{
	@Override
	protected ModelAndView doHandleRequest(HttpServletRequest request,HttpServletResponse response) throws Exception {
		response.setContentType("text/html; charset=UTF-8");
		String contextPath=request.getContextPath();
		StringBuffer sb=new StringBuffer();
		sb.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n");
		sb.append("<html>\n");
		sb.append("<head>\n");
		sb.append("<script  type=\"text/javascript\">\n");
		sb.append("window.contextPath=\""+contextPath+"\";\n");
		sb.append("</script>\n");
		sb.append("<script type=\"text/javascript\" src=\""+contextPath+"/dorado/res/ckeditor/jquery.min.js\"></script>\n");
		sb.append("<script type=\"text/javascript\" src=\""+contextPath+"/dorado/res/dorado/scripts/uflo-form.js\"></script>\n");
		sb.append("<script type=\"text/javascript\" src=\""+contextPath+"/dorado/res/ckeditor/ckeditor.js\"></script>\n");
		sb.append("<script type=\"text/javascript\" src=\""+contextPath+"/dorado/res/ckeditor/adapters/jquery.js\"></script>\n");
		sb.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
		sb.append("<title>UFLO表单设计器</title>\n");
		sb.append("</head>\n");
		sb.append("<body style=\"margin:0px\">\n");
		sb.append("	<textarea id=\"editorContainer\" style=\"height:500px\"></textarea>\n");
		sb.append("");
		sb.append("</body>\n");
		sb.append("</html>\n");
		PrintWriter pw=response.getWriter();
		pw.write(sb.toString());
		pw.flush();
		pw.close();
		return null;
	}
}
